package com.jl.jlapp.popu;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.CardView;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.jl.jlapp.R;
import com.jl.jlapp.mvp.activity.BaseActivity;

public class OrderPromptPopu extends PopupWindow {
    TextView cancelBtn;
    CardView cardView;
    TextView okBtn;
    TextView popuContent;
    private TextView tvKnow;
    private View view;

    public OrderPromptPopu(final Context paramContext, OnClickListener paramOnClickListener, Integer paramInteger1, Integer paramInteger2) {
        super(paramContext);
        this.view = ((LayoutInflater) paramContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.order_prompt_popu, null);
        this.cardView = ((CardView) this.view.findViewById(R.id.layout));
        this.cancelBtn = ((TextView) this.view.findViewById(R.id.clear_history_bottom_cancel_btn));
        this.okBtn = ((TextView) this.view.findViewById(R.id.clear_history_bottom_ok_btn));
        this.popuContent = ((TextView) this.view.findViewById(R.id.popu_content));
        this.cancelBtn.setVisibility(View.VISIBLE);
        if (paramInteger1.intValue() == 1) {
            this.popuContent.setText("抱歉，您购买的商品均已售空，请选择其他同类商品。");
            this.cancelBtn.setVisibility(View.GONE);
            this.okBtn.setText("返回首页");
        }
        for (; ; ) {
            this.okBtn.setOnClickListener(paramOnClickListener);
            setContentView(this.view);
            setWidth(-1);
            setHeight(-1);
            setFocusable(true);
            setAnimationStyle(R.style.AnimBottom);
            setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(paramContext,R.color.white)));
            this.cancelBtn.setOnClickListener(new OnClickListener() {
                public void onClick(View paramAnonymousView) {
                    Intent intent = new Intent(paramContext, BaseActivity.class);
                    paramContext.startActivity(intent);
                    OrderPromptPopu.this.dismiss();
                }
            });
            this.view.setOnTouchListener(new OnTouchListener() {
                public boolean onTouch(View paramAnonymousView, MotionEvent paramAnonymousMotionEvent) {
                    int i = OrderPromptPopu.this.cardView.getTop();
                    int j = OrderPromptPopu.this.cardView.getLeft();
                    int k = OrderPromptPopu.this.cardView.getWidth();
                    int m = OrderPromptPopu.this.cardView.getHeight();
                    int n = (int) paramAnonymousMotionEvent.getY();
                    int i1 = (int) paramAnonymousMotionEvent.getX();
                    if ((paramAnonymousMotionEvent.getAction() == 1) && ((n < i) || (i1 < j) || (n > i + m) || (i1 > j + k))) {
                        OrderPromptPopu.this.dismiss();
                    }
                    return true;
                }
            });
            if (paramInteger1.intValue() == 2) {
                this.popuContent.setText("抱歉，您购买的部分商品已售空，继续下单则移出已售空商品。");
            } else if (paramInteger1.intValue() == 3) {
                this.popuContent.setText("抱歉，您购买的部分商品已售空或库存不足，继续下单则移出已售空商品以及购买部分商品的剩余数量。");
            } else if (paramInteger1.intValue() == 4) {
                this.popuContent.setText("抱歉，您选购的商品仅剩" + paramInteger2 + "件，继续下单将购买当前商品的剩余数量。");
            } else if (paramInteger1.intValue() == 5) {
                this.popuContent.setText(" 抱歉，您购买的部分商品库存数量不足，继续下单将购买当前商品的剩余数量。");
            }
        }
    }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/popu/OrderPromptPopu.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */